require("Intention")

IntentionsManager = class("IntentionsManager")

---

function IntentionsManager:initialize()

	self.intentions = {}
end

---

function IntentionsManager:addIntention(sentenceDescriptor)

	local newIntention = Intention:new(sentenceDescriptor)
	
	self.intentions[#self.intentions + 1] = newIntention
	
	return newIntention
end

---

function IntentionsManager:onContainerSoonToBeObserved(container)

	for intentionIndex, intention in ipairs(self.intentions)
	do
		if 
			(not intention:isRealized()) and
			intention:isImplyingEntity(container)
		then
			intention:tryToRealize()
		end
	end
end
